package org.nstack.header.storage.snapshot;

import org.nstack.header.query.ExpandedQueries;
import org.nstack.header.query.ExpandedQuery;
import org.nstack.header.search.Inventory;
import org.nstack.header.storage.backup.BackupStorageInventory;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;


@Inventory(mappingVOClass = VolumeSnapshotBackupStorageRefVO.class)
@ExpandedQueries({
        @ExpandedQuery(expandedField = "volumeSnapshot", inventoryClass = VolumeSnapshotInventory.class,
                foreignKey = "volumeSnapshotUuid", expandedInventoryKey = "uuid"),
        @ExpandedQuery(expandedField = "backupStorage", inventoryClass = BackupStorageInventory.class,
                foreignKey = "backupStorageUuid", expandedInventoryKey = "uuid"),
})
public class VolumeSnapshotBackupStorageRefInventory {

    private String volumeSnapshotUuid;

    private String backupStorageUuid;

    private String installPath;

    public static VolumeSnapshotBackupStorageRefInventory valueOf(VolumeSnapshotBackupStorageRefVO vo) {
        VolumeSnapshotBackupStorageRefInventory inv = new VolumeSnapshotBackupStorageRefInventory();
        inv.setBackupStorageUuid(vo.getBackupStorageUuid());
        inv.setInstallPath(vo.getInstallPath());
        inv.setVolumeSnapshotUuid(vo.getVolumeSnapshotUuid());
        return inv;
    }

    public static List<VolumeSnapshotBackupStorageRefInventory> valueOf(Collection<VolumeSnapshotBackupStorageRefVO> vos) {
        List<VolumeSnapshotBackupStorageRefInventory> invs = new ArrayList<VolumeSnapshotBackupStorageRefInventory>();
        for (VolumeSnapshotBackupStorageRefVO vo : vos) {
            invs.add(valueOf(vo));
        }

        return invs;
    }

    public String getVolumeSnapshotUuid() {
        return volumeSnapshotUuid;
    }

    public void setVolumeSnapshotUuid(String volumeSnapshotUuid) {
        this.volumeSnapshotUuid = volumeSnapshotUuid;
    }

    public String getBackupStorageUuid() {
        return backupStorageUuid;
    }

    public void setBackupStorageUuid(String backupStorageUuid) {
        this.backupStorageUuid = backupStorageUuid;
    }

    public String getInstallPath() {
        return installPath;
    }

    public void setInstallPath(String installPath) {
        this.installPath = installPath;
    }
}
